﻿using IterationLife.Datas;
using IterationLife.Educations.Models;
using IterationLife.Educations.Queries;
using IterationLife.Educations.Repositories;
using IterationLife.PlatformBackEnd.AppServices.Contracts.Educations;
using IterationLife.PlatformBackEnd.AppServices.Dtos.Educations;
using Util.Applications;
using Util.Datas.Queries;

namespace IterationLife.PlatformBackEnd.AppServices.Impl.Educations {
    /// <summary>
    /// 能力标准服务
    /// </summary>
    public class AbilityStandardService : ApplicationServiceBase<AbilityStandard, AbilityStandardDto, AbilityStandardQuery>, IAbilityStandardService {
        /// <summary>
        /// 初始化能力标准服务
        /// </summary>
        /// <param name="unitOfWork">工作单元</param>
        /// <param name="abilityStandardRepository">能力标准仓储</param>
        public AbilityStandardService( IApplicationUnitOfWork unitOfWork, IAbilityStandardRepository abilityStandardRepository )
            : base( unitOfWork, abilityStandardRepository ) {
            AbilityStandardRepository = abilityStandardRepository;
        }
        
        /// <summary>
        /// 能力标准仓储
        /// </summary>
        protected IAbilityStandardRepository AbilityStandardRepository { get; set; }
        
        /// <summary>
        /// 转换为数据传输对象
        /// </summary>
        /// <param name="entity">实体</param>
        protected override AbilityStandardDto ToDto( AbilityStandard entity ) {
            return entity.ToDto();
        }

        /// <summary>
        /// 转换为实体
        /// </summary>
        /// <param name="dto">数据传输对象</param>
        protected override AbilityStandard ToEntity( AbilityStandardDto dto ) {
            return dto.ToEntity();
        }
        
        /// <summary>
        /// 创建查询对象
        /// </summary>
        /// <param name="param">能力标准查询实体</param>
        protected override IQueryBase<AbilityStandard> CreateQuery( AbilityStandardQuery param ) {
            return new Query<AbilityStandard>( param );
        }
    }
}